package norbert.containers {
	/* IMPORTS */
	
	import mx.containers.TitleWindow;
	import mx.core.ScrollPolicy;
	import mx.events.CloseEvent;

	public class ToolPanel extends TitleWindow implements IToolPanel {
		include "toolPanelImpl.as";
		
		/* PROPERTIES */
		
		private var _collapsed: Boolean = false;
		
		/* CONTRUCTOR */
		
		public function ToolPanel() {
			percentWidth = 100;
			minWidth = 100;
			showCloseButton = true;
			addEventListener(CloseEvent.CLOSE, onClose);
		}
		
		/* EVENT LISTENERS */
		
		private function onClose(event: CloseEvent): void {
			if (_collapsed) {
				height = measuredHeight;
			} else {
				height = titleBar.height;
			}
			_collapsed = !_collapsed;
		}
	}
}
